{% extends "base.html" %}
{% block title %}{{ student.name }}的详情{% endblock %}

{% block content %}
<div class="row">
    <div class="col-md-4">
        <div class="card mb-4">
            <div class="card-header">
                <h5>学生信息</h5>
            </div>
            <div class="card-body">
                <p><strong>学号:</strong> {{ student.student_id }}</p>
                <p><strong>姓名:</strong> {{ student.name }}</p>
                <p><strong>性别:</strong> {{ student.gender }}</p>
                <p><strong>班级:</strong> {{ student.class_name }}</p>
                <p><strong>出生日期:</strong> {{ student.birth_date }}</p>
                <p><strong>入学日期:</strong> {{ student.admission_date }}</p>
                <p><strong>联系方式:</strong> {{ student.contact_phone }}</p>
                <p><strong>邮箱:</strong> {{ student.email }}</p>
            </div>
        </div>

        <div class="card">
            <div class="card-header">
                <h5>成绩概览</h5>
            </div>
            <div class="card-body">
                <p><strong>平均分:</strong> {{ "%.2f"|format(avg_score) }}</p>
                <p><strong>GPA:</strong> {{ "%.2f"|format(gpa) }}</p>
            </div>
        </div>
    </div>

    <div class="col-md-8">
        <div class="card">
            <div class="card-header">
                <h5>课程成绩</h5>
            </div>
            <div class="card-body">
                <table class="table">
                    <thead>
                        <tr>
                            <th>课程名称</th>
                            <th>学分</th>
                            <th>成绩</th>
                            <th>学年学期</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for score, course in scores %}
                        <tr>
                            <td>{{ course.name }}</td>
                            <td>{{ course.credit }}</td>
                            <td>{{ score.score }}</td>
                            <td>{{ score.academic_year }} {{ score.semester }}</td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
{% endblock %}